package com.zhiyou100.controller;

import com.zhiyou100.exception.ExamException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

@ControllerAdvice
public class ExceptionController {
    @ExceptionHandler(value=ExamException.class)
    public ModelAndView examExceptionAction(ExamException e){
        System.out.println(e);
        ModelAndView view=new ModelAndView();
        view.setViewName("error");
        view.addObject("e",e);
        return view;
    }
}
